<template>
	<view class="">
		<s-pull-scroll ref="pullScroll" :pullDown="pullDown" :pullUp="loadData" :back-top="true">
			<view class="column center" style="padding-top:30upx;">
				<view class="item" v-for="(item, index) in dataList" :key="index" @tap="itemOnClick(item)">
					<view class="row between" style="line-height: 40upx;">
						<view class="item-tips">重要通知提醒</view>
						<view class="notice-time">{{ item.createDate }}</view>
					</view>
					<view class="item-title clamp b-b">{{ item.title }}</view>
					<view class="row between" style="padding:20upx 0;">
						<view class="item-more">查看详情</view>
						<u-icon name="arrow-right" color="#999999" size="22"></u-icon>
					</view>
				</view>
			</view>
			
		</s-pull-scroll>
		
		<!-- <mix-loading v-if="isLoading"></mix-loading> -->
	</view>
</template>

<script>
export default {
	data() {
		return {
			dataList: []
		};
	},
	onLoad() {
		this.refresh();
	},
	methods: {
		itemOnClick(item) {
			getApp().globalData.noticeItem = item;
			this.navTo("/pages/public/noticeDetails");
		},
		pullDown(pullScroll) {
			setTimeout(() => {
				this.loadData(pullScroll);
			}, 200);
		},
		async loadData(pullScroll) {
			const data = {
				uid:uni.getStorageSync('uid'),
				pageNo: pullScroll.page,
				pageSize: 10
			};
			const res = await this.$request("content/announcement", data,{showLoading:true});
			if (pullScroll.page == 1) {
				this.dataList = [];
			}
			if (res.result == 1 || res.data.list.length == 0) {
				pullScroll.empty();
				return;
			}
			this.teamNumber = res.data.count;
			this.dataList = this.dataList.concat(res.data.list);
			pullScroll.page >= Math.ceil(res.data.count / 10) ? pullScroll.finish() : pullScroll.success();
		}
	}
};
</script>
<style>
page {
	background: #fafafa;
}
</style>
<style scoped>
.item {
	width: 94%;
	padding: 20upx 30upx;
	background: #ffffff;
	border-radius: 20upx;
	margin-bottom: 20upx;
}
.item-title {
	font-size: 28upx;
	font-family: PingFang SC;
	font-weight: bold;
	color: #333333;
	line-height: 36upx;
	text-align: left;
	padding: 30upx 0;
}
.item-tips {
	font-size: 24upx;
	font-family: PingFang SC;
	font-weight: 500;
	color: #666666;
}
.notice-time {
	font-size: 24upx;
	font-family: PingFang SC;
	font-weight: 500;
	color: #8f8f8f;
}
.item-more {
	font-size: 22upx;
	font-family: PingFang SC;
	font-weight: 500;
	color: #896c4d;
}
</style>
